import axios from "axios";

let apiUrl = "http://49.234.115.34:8090/"
let esUrl = "http://121.36.3.252:9200"

axios.interceptors.request.use(config=>{
	// console.log(config);
	let url = config.url;
	
	if(url.startsWith("/api")){
		config.withCredentials = true;
		//后端接口拦截
		// config.url = apiUrl+url
	}else if(url.startsWith("/es")||url.startsWith("es")){
		//es接口拦截
		config.url = url.replace(/^\/?es/,esUrl)
	}
	return config;
},err=>{
	return err;
})

export default axios;